""" Matt Williams mattyjwilliams@gmail.com """

"""
My interpretation of the rules is as follows

start_food = 300 * (players - 1)

hunts_per_round = players - 1

Hunting Food

both_hunt food += 0
one_hunt food += if hunted: -3 else 1
both_slack food += -2

Therefore order of hunting outcomes
1. I slack he hunts
2. Both hunt
3. Both slack
4. I hunt he slacks


reputation = num_hunts / (num_times + times_slacked)

Reputation is the only metric I have for working out if other players are
hunting or slacking


MY STRATEGY

I need to identify which players are hunting and hunt with them to satisfy 2nd
best outcome, but it would be useful if I occasionaly slacked when another
player hunts to satisfy the best outcome, therefore I shall set my threshold
for hunting mid-way between 1 and 0.5 to make sure I hunt with others who hunt
alot, but I also slack with some as well.

However I am also going to have some survival modes: If my food drops below 20
I'm going to only slack. My motivation in this competition is getting a t
shirt, so if it's going badly let's just try to survive as long as possible.
"""

my_food = 0  # Example optional module variable


def hunt_choices(round_number, current_food, current_reputation, m,
        player_reputations):

    global my_food
    my_food = current_food
    #print "MYFOOD", my_food

    hunt_decisions = ['h' if x > 0.7 else 's' for x in player_reputations]
    if my_food < 20 or len(player_reputations) < 10:
        hunt_decisions = ['s' for x in player_reputations]

    return hunt_decisions


def hunt_outcomes(food_earnings):

    global my_food
    my_food += sum(food_earnings)
    #print "MYFOOD", my_food
    return None


def round_end(award, m, number_hunters):

    global my_food
    my_food += award
    #print "MYFOOD", my_food
    return None
